﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}

<script type="text/javascript">
    var keyValue = $.request("keyValue");
    $(function () {
        getItemList();
        GetEntity();
    });

    function GetEntity() {
        $.ajax({
            url: "/MyTask/MyCustomerInfo/GetEntity?keyValue=" + keyValue,
            dataType: "json",
            async: false,
            success: function (data) {
                console.log(data);
                $("#form1").formSerialize(data);
            }, error: function (XMLHttpRequest, textStatus, errorThrown) {
                console.log(XMLHttpRequest);
                console.log(textStatus);
                console.log(errorThrown);
            }
        });
    }

    function getItemList() {
        $.ajax({
            url: "/MyTask/MyCustomerInfo/GetItemListJson",
            dataType: "json",
            async: false,
            success: function (data) {
                initControl(data)
            }, error: function (XMLHttpRequest, textStatus, errorThrown) {
                console.log(XMLHttpRequest);
                console.log(textStatus);
                console.log(errorThrown);
            }
        });
    }

    function initControl(data) {
        var citys = data.citys;
        for (var i = 0; i < citys.length; i++) {
            $("#F_CityId").append("<option value='" + citys[i].F_ItemCode + "'>" + citys[i].F_ItemName + "</option>");
        }

        var khdjs = data.khdjs;
        for (var i = 0; i < khdjs.length; i++) {
            $("#F_ClientLevel").append("<option value='" + khdjs[i].F_ItemCode + "'>" + khdjs[i].F_ItemName + "</option>");
        }

        var khlxs = data.khlxs;
        for (var i = 0; i < khlxs.length; i++) {
            $("#F_ClientType").append("<option value='" + khlxs[i].F_ItemCode + "'>" + khlxs[i].F_ItemName + "</option>");
        }

        var sshys = data.sshys;
        for (var i = 0; i < sshys.length; i++) {
            $("#F_IndustryId").append("<option value='" + sshys[i].F_ItemCode + "'>" + sshys[i].F_ItemName + "</option>");
        }

        var gszws = data.gszws;
        for (var i = 0; i < gszws.length; i++) {
            $("#F_PositionId").append("<option value='" + gszws[i].F_ItemCode + "'>" + gszws[i].F_ItemName + "</option>");
        }

        var ssbms = data.ssbms;
        for (var i = 0; i < ssbms.length; i++) {
            $("#F_Department").append("<option value='" + ssbms[i].F_ItemCode + "'>" + ssbms[i].F_ItemName + "</option>");
        }
    }
</script>
<form id="form1">
    <div style="padding-top: 20px;">
        <table id="form1" class="form" style="margin-top:3px;">
            <tr>
                <td colspan="6" class="interval">客户信息</td>
            </tr>
            <tr>
                <td colspan="6">
                    <table class="form">
                        <tr>
                            <td class="formTitle">客户名称</td>
                            <td class="formValue"><input id="F_ClientName" name="F_ClientName" type="text" class="form-control required" placeholder="请录入客户名称" /></td>
                            <td class="formTitle">所在城市</td>
                            <td class="formValue">
                                <select id="F_CityId" name="F_CityId" class="form-control required">
                                    <option value="">==请选择城市==</option>
                                </select>
                            </td>
                            <td class="formTitle">客户级别</td>
                            <td class="formValue">
                                <select id="F_ClientLevel" name="F_ClientLevel" class="form-control required">
                                    <option value="">==请选择客户级别==</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td class="formTitle">客户类型</td>
                            <td class="formValue">
                                <select id="F_ClientType" name="F_ClientType" class="form-control required">
                                    <option value="">==请选择客户类型==</option>
                                </select>
                            </td>
                            <td class="formTitle"></td>
                            <td class="formValue"></td>
                            <td class="formTitle"></td>
                            <td class="formValue"></td>
                        </tr>
                    </table>
                </td>
            </tr>
            @*<tr>
                <td colspan="6" class="interval">项目组信息</td>
            </tr>
            <tr>
                <td colspan="6">
                    <table class="form">
                        <tr>
                            <td class="formTitle">品牌/项目组</td>
                            <td class="formValue">
                                <input id="F_ProjectName" name="F_ProjectName" type="text" class="form-control required" placeholder="请录入品牌/项目组" />
                            </td>
                            <td class="formTitle">所属行业</td>
                            <td class="formValue">
                                <select id="F_IndustryId" name="F_IndustryId" class="form-control required">
                                    <option value="">==请选择所属行业==</option>
                                </select>
                            </td>
                            <td class="formTitle">联系人</td>
                            <td class="formValue">
                                <input id="F_Contract" name="F_Contract" type="text" class="form-control required" placeholder="请录入联系人" />
                            </td>
                        </tr>
                        <tr>
                            <td class="formTitle">所属部门</td>
                            <td class="formValue">
                                <select id="F_Department" name="F_Department" class="form-control">
                                    <option value="">==请选择所属部门==</option>
                                </select>
                            </td>
                            <td class="formTitle">公司职位</td>
                            <td class="formValue">
                                <select id="F_PositionId" name="F_PositionId" class="form-control">
                                    <option value="">==请选择公司职位==</option>
                                </select>
                            </td>
                            <td class="formTitle">联系电话</td>
                            <td class="formValue">
                                <input id="F_Phone" name="F_Phone" type="text" maxlength="11" minlength="11" class="form-control required" placeholder="请录入联系电话" />
                            </td>
                        </tr>
                        <tr>
                            <td class="formTitle">公司邮箱</td>
                            <td class="formValue">
                                <input id="F_Mail" name="F_Mail" type="email" class="form-control" placeholder="请录入公司邮箱" />
                            </td>
                            <td class="formTitle"></td>
                            <td class="formValue"></td>
                            <td class="formTitle"></td>
                            <td class="formValue"></td>
                        </tr>
                    </table>
                </td>
            </tr>*@
        </table>
    </div>
</form>